$(function () {
    zkdmxGrid($.webPath() + '/kcgl/zksq/zkd_zkdmx?zkdId=' + $("[name='zkd.id']").val()||'');

    $("#zkd_zkdfy_table").datagrid({
        onLoadSuccess:function(){
            $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
        }
    })
})

function zkdmxGrid(href, cdOptions, fsOptions) {
    $("#zkd_mx_table").edatagrid({
        url:href,
        fitColumns:false,
        singleSelect:true,
        fit:true,
        checkOnSelect:false,
        selectOnCheck:false,
        showFooter:true,
        rownumbers:true,
        toolbar:"#zkd_zkdmx_toolbar",
        columns:[
            [
                {field:'wzgg.id', title:'物资ID', hidden:true},
                {field:'wzgg.code', title:'物资编码', width:100,align: 'center'},
                {field:'wzgg.name', title:'物资名称', width:100,align: 'center'},
                {field:'wzgg.ggxh', title:'规格型号', width:100,align: 'center'},
                {field:'wzgg.dw', title:'单位', width:70,align: 'center'},
                {field:'wzgg.th', title:'图号', width:70,align: 'center'},
                {field:'kh.id', title:'卡号ID', hidden:true},
                {field:'kh.khbm', title:'卡号', width:120,align: 'center'},
                {field:'kh.nkhbm', title:'新卡号', width:120,align: 'center'},
                {field:'zkjs',title:'开单件数', width:100,align: 'right'},
                {field:'zksl',title:'开单数量', width:100,align: 'right',
                    formatter:function(value){
                        var val = formatSlForHtml(value);
                        return val;
                    }},
                {field:'zcjs',title:'转出件数', width:100,align: 'right'},
                {field:'zcsl',title:'转出数量', width:100,align: 'right',
                    formatter:function(value){
                        var val = formatSlForHtml(value);
                        return val;
                    }},
                {field:'zrjs',title:'转入件数', width:100,align: 'right'},
                {field:'zrsl',title:'转入数量', width:100,align: 'right',
                    formatter:function(value){
                        var val = formatSlForHtml(value);
                        return val;
                    }},
                {field:'bz', editor:{type:'text'}, title:'备注', width:100,align: 'center'}
            ]
        ],
        onLoadSuccess:function(){
            $(".datagrid-htable .datagrid-cell").css('text-align', 'center');
        }
    })
}




